home *** CD-ROM | disk | FTP | other *** search
- #
- # wfcommand: generic page loader
- #
- # Copyright (C) 1994 Afzal Ballim
-
- require "ABSWFBIN/LIBWEBFORUM.PL";
-
- # read the input from the form.
- %in=&WFReadParse;
-
- # subject has to have / protected and ^
- #if ($in{"subject"} ne "") {
- # $in{"subject"} =~ s#([^\\])/#$1\ª#g;
- # $in{"subject"} =~ s#\^#\╖#g;
- #}
-
- # The command is given via PATH_INFO or form variables.
- # The PATH_INFO version takes precedence.
-
- %pi=&WFDecodePathInfo;
-
- if ($pi{"command"}) {
- $in{"command"}=$pi{"command"};
- }
-
- #let's get the easy bit out of the way: a header
- &WFHtmlHeader;
-
- # Now, let's process that command.
- if (!$in{"command"}) {
- &WFError(
- "<p>Something weird has happened and I can't find what
- command you gave me. Try contacting CREATOR.
- Useful information to include with your error message
- would be the command you <i>thought</i> you were
- calling.</p>
- <p><i>Note:</i> This may have been caused because you tried
- to reload the page. Unfortunately, these pages are not (currently)
- reload-able with the reader's reload function. You must instead
- click on the 'Rescan' button supplied with the pages.</p>
-
- <p>Please note, that due to the complexity of this system,
- not all client programs will function with it. Lynx 2.3
- does not work, and I do not know of any line-based client
- that does. NCSA Mosaic 2.4 works, as does Netscape 0.9.");
-
- exit;
- }
-
- # The set of supported commands.
- # Commands return a null string if they succeed, or an
- # error message if they don't.
- # When a command fails, we try another command if we can
- # The onfail list is just a convenient table of command
- # failure changes.
- %onfail= ("top","",
- "forum","top",
- "subject","forum",
- "message","subject",
- "nextmessage","subject",
- "prevmessage","subject",
- "reply","message",
- "followup","subject",
- "post","forum",
- "cancel","message",
- "mkmsg","subject");
-
- $CommandToDo=$in{"command"};
-
- # Logging
- if (LOGLEVEL != 0) {
- if ((LOGLEVEL == 1) && $in{"command"} eq "top") {
- system("echo `/bin/date` $ENV{REMOTE_USER} >> LOGFILE");
- }
- else {
- $lstring="$ENV{REMOTE_USER}:" .
- $in{"command"} . "/" .
- &WFDecodeDatum($in{"forum"}) . "/" .
- &WFDecodeDatum($in{"subject"}) . "/" .
- &WFDecodeDatum($in{"message"});
- system("echo `/bin/date` '$lstring' >>LOGFILE");
- }
- }
-
- while ($CommandToDo ne "exit") {
- The_Commands: {
- $CommandToDo eq "" && &WFError("No Command!") && exit(1);
-
- $CommandToDo eq "top" && do {
- require "ABSWFCTRLBIN/STD_TOP.PL";
- if (($WFCR=&WFCommandTop(%in)) ne ""){
- &WFError($WFCR);
- $CommandToDo=$onfail{"top"};last The_Commands;};
- $CommandToDo="exit";last The_Commands;};
-
- $CommandToDo eq "forum" && do {
- require "ABSWFCTRLBIN/STD_FORUM.PL";
- if (($WFCR=&WFCommandForum(%in)) ne ""){
- &WFError($WFCR);
- $CommandToDo=$onfail{"forum"};last The_Commands;}
- $CommandToDo="exit";last The_Commands;};
-
- $CommandToDo eq "subject" && do {
- require "ABSWFCTRLBIN/STD_SUBJECT.PL";
- if (($WFCR=&WFCommandSubject("first",%in)) ne ""){
- &WFError($WFCR);
- $CommandToDo=$onfail{"subject"};last The_Commands;};
- $CommandToDo="exit";last The_Commands;};
-
- $CommandToDo eq "message" && do {
- require "ABSWFCTRLBIN/STD_SUBJECT.PL";
- if (($WFCR=&WFCommandSubject("this",%in)) ne ""){
- &WFError($WFCR);
- $CommandToDo=$onfail{"message"};last The_Commands;};
- $CommandToDo="exit";last The_Commands;};
-
- $CommandToDo eq "nextmessage" && do {
- require "ABSWFCTRLBIN/STD_SUBJECT.PL";
- if (($WFCR=&WFCommandSubject("next",%in)) ne ""){
- &WFError($WFCR);
- $CommandToDo=$onfail{"nextmessage"};last The_Commands;};
- $CommandToDo="exit";last The_Commands;};
-
- $CommandToDo eq "prevmessage" && do {
- require "ABSWFCTRLBIN/STD_SUBJECT.PL";
- if (($WFCR=&WFCommandSubject("prev",%in)) ne ""){
- &WFError($WFCR);
- $CommandToDo=$onfail{"prevmessage"};last The_Commands;};
- $CommandToDo="exit";last The_Commands;};
-
- $CommandToDo eq "post" && do {
- require "ABSWFCTRLBIN/STD_POST.PL";
- if (($WFCR=&WFCommandPost("post",%in)) ne ""){
- &WFError($WFCR);
- $CommandToDo=$onfail{"post"};last The_Commands;};
- $CommandToDo="exit";last The_Commands;};
-
- $CommandToDo eq "followup" && do {
- require "ABSWFCTRLBIN/STD_POST.PL";
- if (($WFCR=&WFCommandPost("followup",%in)) ne ""){
- &WFError($WFCR);
- $CommandToDo=$onfail{"followup"};last The_Commands;};
- $CommandToDo="exit";last The_Commands;};
-
- $CommandToDo eq "reply" && do {
- require "ABSWFCTRLBIN/STD_POST.PL";
- if (($WFCR=&WFCommandPost("reply",%in)) ne ""){
- &WFError($WFCR);
- $CommandToDo=$onfail{"reply"};last The_Commands;};
- $CommandToDo="exit";last The_Commands;};
-
- $CommandToDo eq "mkmsg" && do {
- require "ABSWFCTRLBIN/STD_MKMSG.PL";
- if (($WFCR=&WFCommandMkmsg(%in)) ne ""){
- &WFError($WFCR);
- $CommandToDo=$onfail{"mkmsg"};last The_Commands;};
- $CommandToDo="subject";last The_Commands;};
-
- $CommandToDo eq "cancel" && do {
- require "ABSWFCTRLBIN/STD_CANCEL.PL";
- if (($WFCR=&WFCommandCancel(%in)) ne ""){
- &WFError($WFCR);
- $CommandToDo=$onfail{"cancel"};last The_Commands;};
- $CommandToDo="subject";last The_Commands;};
-
- do {
- &WFError("Unknown or unimplemented command: $CommandToDo\n");
- $CommandToDo="top";
- }
- }
- }
-